package com.ruoyi.oto.controller;

import cn.hutool.core.util.ObjUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.MemberUser;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.oto.constants.CollectionModle;
import com.ruoyi.oto.constants.CompanyShowFlag;
import com.ruoyi.oto.constants.CompanyStatus;
import com.ruoyi.oto.constants.DeleteFlag;
import com.ruoyi.oto.domain.CompanyCore;
import com.ruoyi.oto.domain.CompanyType;
import com.ruoyi.oto.domain.ModelCollection;
import com.ruoyi.oto.domain.dto.CompanyQuryDTO;
import com.ruoyi.oto.domain.dto.CompanyRegDTO;
import com.ruoyi.oto.domain.vo.CompanyTypeVO;
import com.ruoyi.oto.service.CompanyCoreService;
import com.ruoyi.system.service.ISysDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;

/**
 * 小程序-部门控制器
 */
@RestController
@RequestMapping("/api/v2/branch")
public class BranchApiController extends BaseController {

    @Autowired
   private ISysDeptService sysDeptService;

    /**
     * 获取所有的部门
     * @return
     */
    @GetMapping("listBranch")
    public AjaxResult<List<SysDept>> listBranch() {
        SysDept sysDept = new SysDept();
        sysDept.setParentId(101L);
        List<SysDept> list = sysDeptService.toBizDeptList(sysDeptService.selectDeptList(sysDept));
        return AjaxResult.success(list);
    }

}
